(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
rev(nil) → nil
rev(cons(x, l)) → cons(rev1(x, l), rev2(x, l))
rev1(0, nil) → 0
rev1(s(x), nil) → s(x)
rev1(x, cons(y, l)) → rev1(y, l)
rev2(x, nil) → nil
rev2(x, cons(y, l)) → rev(cons(x, rev2(y, l)))
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
rev(nil) → nil
rev(cons(x, l)) → cons(rev1(x, l), rev2(x, l))
rev1(0', nil) → 0'
rev1(s(x), nil) → s(x)
rev1(x, cons(y, l)) → rev1(y, l)
rev2(x, nil) → nil
rev2(x, cons(y, l)) → rev(cons(x, rev2(y, l)))
S is empty.
Rewrite Strategy: INNERMOST
(3) SlicingProof (LOWER BOUND(ID) transformation)
Sliced the following arguments:
s/0
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
rev(nil) → nil
rev(cons(x, l)) → cons(rev1(x, l), rev2(x, l))
rev1(0', nil) → 0'
rev1(s, nil) → s
rev1(x, cons(y, l)) → rev1(y, l)
rev2(x, nil) → nil
rev2(x, cons(y, l)) → rev(cons(x, rev2(y, l)))
S is empty.
Rewrite Strategy: INNERMOST
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
Innermost TRS:
Rules:
rev(nil) → nil
rev(cons(x, l)) → cons(rev1(x, l), rev2(x, l))
rev1(0', nil) → 0'
rev1(s, nil) → s
rev1(x, cons(y, l)) → rev1(y, l)
rev2(x, nil) → nil
rev2(x, cons(y, l)) → rev(cons(x, rev2(y, l)))
Types:
rev :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s → nil:cons → nil:cons
rev1 :: 0':s → nil:cons → 0':s
rev2 :: 0':s → nil:cons → nil:cons
0' :: 0':s
s :: 0':s
hole_nil:cons1_0 :: nil:cons
hole_0':s2_0 :: 0':s
gen_nil:cons3_0 :: Nat → nil:cons
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
rev,
rev1,
rev2They will be analysed ascendingly in the following order:
rev1 < rev
rev = rev2
(8) Obligation:
Innermost TRS:
Rules:
rev(
nil) →
nilrev(
cons(
x,
l)) →
cons(
rev1(
x,
l),
rev2(
x,
l))
rev1(
0',
nil) →
0'rev1(
s,
nil) →
srev1(
x,
cons(
y,
l)) →
rev1(
y,
l)
rev2(
x,
nil) →
nilrev2(
x,
cons(
y,
l)) →
rev(
cons(
x,
rev2(
y,
l)))
Types:
rev :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s → nil:cons → nil:cons
rev1 :: 0':s → nil:cons → 0':s
rev2 :: 0':s → nil:cons → nil:cons
0' :: 0':s
s :: 0':s
hole_nil:cons1_0 :: nil:cons
hole_0':s2_0 :: 0':s
gen_nil:cons3_0 :: Nat → nil:cons
Generator Equations:
gen_nil:cons3_0(0) ⇔ nil
gen_nil:cons3_0(+(x, 1)) ⇔ cons(0', gen_nil:cons3_0(x))
The following defined symbols remain to be analysed:
rev1, rev, rev2
They will be analysed ascendingly in the following order:
rev1 < rev
rev = rev2
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
rev1(
0',
gen_nil:cons3_0(
n5_0)) →
0', rt ∈ Ω(1 + n5
0)
Induction Base:
rev1(0', gen_nil:cons3_0(0)) →RΩ(1)
0'
Induction Step:
rev1(0', gen_nil:cons3_0(+(n5_0, 1))) →RΩ(1)
rev1(0', gen_nil:cons3_0(n5_0)) →IH
0'
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
Innermost TRS:
Rules:
rev(
nil) →
nilrev(
cons(
x,
l)) →
cons(
rev1(
x,
l),
rev2(
x,
l))
rev1(
0',
nil) →
0'rev1(
s,
nil) →
srev1(
x,
cons(
y,
l)) →
rev1(
y,
l)
rev2(
x,
nil) →
nilrev2(
x,
cons(
y,
l)) →
rev(
cons(
x,
rev2(
y,
l)))
Types:
rev :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s → nil:cons → nil:cons
rev1 :: 0':s → nil:cons → 0':s
rev2 :: 0':s → nil:cons → nil:cons
0' :: 0':s
s :: 0':s
hole_nil:cons1_0 :: nil:cons
hole_0':s2_0 :: 0':s
gen_nil:cons3_0 :: Nat → nil:cons
Lemmas:
rev1(0', gen_nil:cons3_0(n5_0)) → 0', rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:cons3_0(0) ⇔ nil
gen_nil:cons3_0(+(x, 1)) ⇔ cons(0', gen_nil:cons3_0(x))
The following defined symbols remain to be analysed:
rev2, rev
They will be analysed ascendingly in the following order:
rev = rev2
(12) RewriteLemmaProof (EQUIVALENT transformation)
Proved the following rewrite lemma:
rev2(
0',
gen_nil:cons3_0(
n215_0)) →
gen_nil:cons3_0(
n215_0), rt ∈ Ω(2
n)
Induction Base:
rev2(0', gen_nil:cons3_0(0)) →RΩ(1)
nil
Induction Step:
rev2(0', gen_nil:cons3_0(+(n215_0, 1))) →RΩ(1)
rev(cons(0', rev2(0', gen_nil:cons3_0(n215_0)))) →IH
rev(cons(0', gen_nil:cons3_0(c216_0))) →RΩ(1)
cons(rev1(0', gen_nil:cons3_0(n215_0)), rev2(0', gen_nil:cons3_0(n215_0))) →LΩ(1 + n2150)
cons(0', rev2(0', gen_nil:cons3_0(n215_0))) →IH
cons(0', gen_nil:cons3_0(c216_0))
We have rt ∈ Ω(2n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(2n)
(13) BOUNDS(2^n, INF)
(14) Obligation:
Innermost TRS:
Rules:
rev(
nil) →
nilrev(
cons(
x,
l)) →
cons(
rev1(
x,
l),
rev2(
x,
l))
rev1(
0',
nil) →
0'rev1(
s,
nil) →
srev1(
x,
cons(
y,
l)) →
rev1(
y,
l)
rev2(
x,
nil) →
nilrev2(
x,
cons(
y,
l)) →
rev(
cons(
x,
rev2(
y,
l)))
Types:
rev :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s → nil:cons → nil:cons
rev1 :: 0':s → nil:cons → 0':s
rev2 :: 0':s → nil:cons → nil:cons
0' :: 0':s
s :: 0':s
hole_nil:cons1_0 :: nil:cons
hole_0':s2_0 :: 0':s
gen_nil:cons3_0 :: Nat → nil:cons
Lemmas:
rev1(0', gen_nil:cons3_0(n5_0)) → 0', rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:cons3_0(0) ⇔ nil
gen_nil:cons3_0(+(x, 1)) ⇔ cons(0', gen_nil:cons3_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
rev1(0', gen_nil:cons3_0(n5_0)) → 0', rt ∈ Ω(1 + n50)
(16) BOUNDS(n^1, INF)